//这里进行文件的重命名
const fs=require("fs")
const path=require("path")
const { v4: uuidv4 } = require('uuid')
const uploadPath="../public/imgs"
const modify=async (newName,originalName)=>{
    
    var extname=path.extname(originalName)//获取文件后缀名
    var newname=uuidv4()+extname//获取新名字，以便返回新文件路径
    fs.renameSync(path.join(__dirname,uploadPath+'/'+newName),path.join(__dirname,uploadPath+'/'+newname))

    return newname
}

module.exports=modify